(define (cubic x)
  (cubic-iter 1.0 x))

(define (cubic-iter guess x)
  (if (good-enough? guess (improve guess x))
    guess
    (cubic-iter (improve guess x) x)))

(define (improve guess x)
  (/ (+ (/ x (square guess)) (* 2 guess)) 3))

(define (good-enough? guess guess-new)
  (< (abs (- guess guess-new)) 0.0001))
